import { createRouter, createWebHashHistory } from 'vue-router';
import Layout from '@/views/Layout/index.vue';

const routes = [
    {
        path: '/',
        hidden: true,
        redirect: { name: 'Login' }
    },
    {
        path: "/login",
        name: "Login",
        hidden: true,
        component: ()=> import('@/views/Login/index.vue')
    },
    {
        path: "/console",
        name: "Console",
        hidden: true,
        component: ()=> import('@/views/Layout/index.vue'),
        redirect: "index",
        children: [
            {
                path: '/index',
                name: 'Index',
                meta: {
                    title: '首页'
                },
                component: () =>
                    import ("@/views/Dashbord/index.vue")
            },
            {
                path: '/record',
                name: 'Record',
                meta: {
                    title: '记录管理'
                },
                component: () =>
                    import ("@/views/Record/index.vue")
            },
            {
                path: '/problem',
                name: 'Problem',
                meta: {
                    title: '缺陷管理'
                },
                component: () =>
                    import ("@/views/Problem/index.vue")
            },
            {
                path: '/useradmin',
                name: 'UserAdmin',
                meta: {
                    title: '用户管理'
                },
                component: () =>
                    import ("@/views/UserAdmin/index.vue")
            }
        ]
    }
]

const router = createRouter({
    history: createWebHashHistory(),
    routes
})

export default router;